home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 1 / Amiga Tools.iso / egs-tools / egs_demo-version / egs_devels / c-include / egsintui.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-06  |  46.3 KB  |  1,223 lines

  1. #ifndef EGS_EGSINTUI_H
  2. #define EGS_EGSINTUI_H
  3.  
  4. /***************************************************************************\
  5. *  $
  6. *  $ FILE     : egsintui.h
  7. *  $ VERSION  : 1
  8. *  $ REVISION : 4
  9. *  $ DATE     : 03-Feb-93 19:16
  10. *  $
  11. *  $ Author   : mvk
  12. *  $
  13. *
  14. *****************************************************************************
  15. *                                                                           *
  16. * (c) Copyright 1990/93 VIONA Development                                   *
  17. *     All Rights Reserved                                                   *
  18. *                                                                           *
  19. \***************************************************************************/
  20.  
  21.  
  22. #ifndef         EXEC_TYPES_H
  23. #include        <exec/types.h>
  24. #endif
  25. #ifndef         EXEC_PORTS_H
  26. #include        <exec/ports.h>
  27. #endif
  28. #ifndef         DEVICES_INPUTEVENT_H
  29. #include        <devices/inputevent.h>
  30. #endif
  31. #ifndef         GRAPHICS_TEXT_H
  32. #include        <graphics/text.h>
  33. #endif
  34. #ifndef         EGS_EGS_H
  35. #include        <egs/egs.h>
  36. #endif
  37. #ifndef         EGS_EGSBLIT_H
  38. #include        <egs/egsblit.h>
  39. #endif
  40. #ifndef         EGS_EGSLAYERS_H
  41. #include        <egs/egslayers.h>
  42. #endif
  43. #ifndef         EGS_EGSGFX_H
  44. #include        <egs/egsgfx.h>
  45. #endif
  46. #ifndef         EGS_EGSINTUIGFX_H
  47. #include        <egs/egsintuigfx.h>
  48. #endif
  49.  
  50.  
  51. /*
  52.  * This library implements a complete window system with menus, gadgets etc.
  53.  * It uses only the other EGS libraries and is thus implementable for other
  54.  * graphics cards than the GVP EGS-110/24.  The library works as indepen-
  55.  * dent from the current graphics mode as possible.
  56.  *
  57.  * The basic structure of the system resembles Commodore's Intuition library.
  58.  * Most names and structures derive from it but are sometimes modified a
  59.  * great deal.
  60.  *
  61.  * The library uses an extended EGS screen type to give you the choice of
  62.  * whether to use the window system or not.
  63.  *
  64.  * All graphics drawing (windows, gadget and menus) is carried out by IntuiGfx
  65.  * stack programs (refer to "egsintuigfx.h") which is the most significant
  66.  * difference to the Commodore library.  The reasons for this technique is the
  67.  * clumsy implementation of Intuition graphics in Commodore's library (three
  68.  * lists, no multiple usage of the structures, waste of memory by overloaded
  69.  * structures and lacking flexibility).  The IntuiGfx solution is so flexible
  70.  * that even the knobs of PropGadets are realised by such a program; even the
  71.  * graphics for window borders is driven by IntuiGfx programs.
  72.  *
  73.  * Unless you use the EGSGadBox library, it is recommended to use
  74.  * "GimmeZeroZero" windows as the overhead is not that gigantic in contrast
  75.  * to Commodore's implementation. However, using a ClipRect (see EGSGfx's
  76.  * EG_InstallClipRect, the same effect can be achieved.
  77.  *
  78.  * Requesters are not implemented in the library since all requesters are in
  79.  * fact windows, and the overhead for an extra structure does not pay.
  80.  *
  81.  * Menus have two new features: they can "hang" at the window border and they
  82.  * can be teared off and then stay open.  The advantage is that the menu way
  83.  * is minimized and often-used menus are accessible directly.
  84.  */
  85.  
  86. typedef struct EI_Window *EI_WindowPtr;
  87. typedef struct EI_EIntuiMsg *EI_EIntuiMsgPtr;
  88.  
  89.  
  90. /*
  91.  * Menus
  92.  *
  93.  * Menus serve to invoke an action or modify a state.  Menus pop up by
  94.  * pressing the right mouse button and appear at the screen or the window
  95.  * title.  A menu item is selected by moving the pointer over it while
  96.  * pressing the right mouse button and releasing the button over it (alter-
  97.  * natively "toggleSelect" menu items can be flipped by shortly pressing the
  98.  * left mouse button).
  99.  *
  100.  * A menu item can have submenus which open when the item is reached with the
  101.  * mouse pointer and which can then be selected.  This nesting is infinite
  102.  * but should not be exaggerated.
  103.  *
  104.  * You can tear off menus, i.e. they stay open even after you released the
  105.  * right mouse button.  This is performed by a special menu item.  These open
  106.  * menus can be selected with the right mouse button and moved with the left
  107.  * one.
  108.  *
  109.  *---------------------------------------------------------------------------
  110.  *
  111.  * Structures:
  112.  *
  113.  * Menu, MenuPtr
  114.  *
  115.  *   .ItemMaster : Pointer to menu item the menu of which is this menu's super
  116.  *                 menu.  NIL if this menu is the main menu.
  117.  *   .MenuMaster : Pointer to menu that is this menu's super menu.  NIL if
  118.  *                 this menu is the main menu.
  119.  *   .FirstItem  : Pointer to the first menu item of this menu.
  120.  *   .LeftEdge,
  121.  *   .TopEdge    : Coordinates of the menu relative to the super menu or
  122.  *                 title bar.
  123.  *   .Width,
  124.  *   .Height     : Menu's size that determines the background that is saved
  125.  *                 when the menu is displayed.  This means the size should at
  126.  *                 least contain the menu with all its menu items but also
  127.  *                 should not exceed that area to save memory.
  128.  *   .Border     : Render program for the basic menu structure without items.
  129.  *                 This stack program is passed over the width (in FP+1) and
  130.  *                 height (in FP+0) of the menu so that it can be used for
  131.  *                 all menus. This routine should also clear the background
  132.  *                 of the menu.
  133.  *
  134.  *  MenuItem, MenuItemPtr
  135.  *
  136.  *   .Prev,
  137.  *   .Next          : Menu item chaining; the first and last menu item
  138.  *                    contain NIL in the corresponding field.
  139.  *   .LeftEdge,
  140.  *   .TopEgde       : Coordinates of the item's top left corner, relative to
  141.  *                    its menu.
  142.  *   .Width,
  143.  *   .Height        : Item's size.
  144.  *   .Active        : Render program if the item is active.
  145.  *   .Passive       : Render program if the item is passive. If this routine
  146.  *                    is NULL the library uses a ghosting feature to show
  147.  *                    unselectable items.
  148.  *   .CheckMark     : Render program if the item is selected for
  149.  *                    "ToggleSelect".
  150.  *   .Select        : Render program executed when the item is actice and
  151.  *                    the mouse touches it.  The program is passed over the
  152.  *                    width (in FP+1) and height (in FP+0) of the item so
  153.  *                    that all items can share the same program.
  154.  *   .Release       : Render program called when the mouse leaves the item.
  155.  *                    The program is passed over the item size, too.  It is
  156.  *                    called even when the menu is drawn so that the normal
  157.  *                    render programs need not draw the graphics for "not
  158.  *                    selected".
  159.  *   .Flags         : Flags of the item:
  160.  *
  161.  *     - MENU_ACTIVE    : Item is active and selectable.
  162.  *     - MENU_SELECTED  : Item is selected; for items that can be switched on
  163.  *                        and off.
  164.  *     - MENU_SELECTABLE: Item is selectable.
  165.  *     - MENU_TOGGLE    : Items toggles its state each time when selected.
  166.  *     - MENU_LEAVE     : Item causes no message but the menu containing this
  167.  *                        item is teared off.
  168.  *
  169.  *   .ID            : Number of the item; is passed over as "code" of the
  170.  *                    EIDCMP message.  The advantage is that for inserting
  171.  *                    new items the message for old items does not change.
  172.  *   .SubMenu       : Submenu, NIL if missing.
  173.  *   .MutualExclude : Set of items that are to be deselected if this item is
  174.  *                    selected.  For those items no extra message is sent.
  175.  *   .MutualInclude : Set of items that are to be selected if this item is
  176.  *                    selected.  For those items no extra message is sent.
  177.  *   .HotKey        : ASCII-Code selecting this item when pressed together
  178.  *                    with the right Amiga key
  179.  *
  180.  *
  181.  * The menu structure is practically only the drawing area on which items are
  182.  * located.  A title bar as for Commodore's Intuition should be designed such
  183.  * that the main menu is as wide as the title bar, and each menu title is an
  184.  * item of this main menu.  The real menus are then logical submenus of that
  185.  * title bar main menu.  Then a Commodore Intuition menu with submenus (e.g.
  186.  * Project.Load.IFFPicture) has really two submenus in the EGSIntui library.
  187.  * For pop up menus it might be better to start with a real vertical
  188.  * oriented menu.
  189.  */
  190.  
  191. /* Corresponding MenuItemFlagSet has 16 bits ! */
  192.  
  193. #define EI_MENU_ACTIVE     1
  194. #define EI_MENU_SELECTED   2
  195. #define EI_MENU_SELECTABLE 4
  196. #define EI_MENU_TOGGLE     8
  197. #define EI_MENU_MOUSED     16
  198. #define EI_MENU_MOVE       32
  199. #define EI_MENU_LEAVE      64
  200.  
  201. typedef struct EI_Menu *EI_MenuPtr;
  202. typedef struct EI_MenuItem *EI_MenuItemPtr;
  203.  
  204. struct EI_Menu {
  205.  
  206.          EI_MenuPtr         WinPrev, WinNext;
  207.          EI_MenuItemPtr     ItemMaster;
  208.          EI_MenuPtr         MenuMaster;
  209.          EI_MenuItemPtr     FirstItem;
  210.          WORD               LeftEdge,TopEdge,
  211.                 Width, Height;
  212.  
  213.          IG_IntuiGfxPtr     Border;
  214.          E_EBitMapPtr       BackSave;
  215.          EL_LayerPtr        Layer;
  216.          EG_RastPortPtr     Rast;
  217. };
  218.  
  219. struct EI_MenuItem {
  220.  
  221.          EI_MenuItemPtr  Prev, Next;
  222.          WORD            LeftEdge, TopEdge, Width, Height;
  223.          IG_IntuiGfxPtr  Active, Passive,
  224.                  CheckMark, Select, Release;
  225.          UWORD           Flags;
  226.          UWORD           Pad_1;
  227.          ULONG           ID;
  228.          EI_MenuPtr      SubMenu;
  229.          ULONG           MutualExclude, MutualInclude;
  230.          BYTE            Pad_2;
  231.          char            HotKey;
  232.          UWORD           Pad_3;
  233. };
  234.  
  235.  
  236.  
  237. /*
  238.  * Gadgets are window elements that the user can click on and thereby give
  239.  * the application information.  There are six kinds of gadgets:
  240.  *
  241.  *   - ActionGadget  : When pressing the gadget the program gets a message.
  242.  *                     This gadget can only be selected.
  243.  *
  244.  *   - BoolGadget    : By pressing this gadget a flag is toggled from TRUE to
  245.  *                     FALSE and vice versa.  With such gadgets flags can be
  246.  *                     requested.  You can choose whether or not you want a
  247.  *                     message when the gadget is selected.
  248.  *
  249.  *   - StringGadget  : In these gadgets you can have a string edited, e.g.
  250.  *                     file names.  The library offers some editing capabili-
  251.  *                     ties which need not be implemented.  If required, you
  252.  *                     can get a message when the gadget is entered and/or
  253.  *                     left.
  254.  *
  255.  *   - PropGadget    : With these gadget a numerical value can be changed.
  256.  *                     For that a knob in a rectangle is created which can be
  257.  *                     moved with the mouse.  Its position indicates the
  258.  *                     value, and its size represents the ratio of its value
  259.  *                     and the maximum number possible.  You can get messages
  260.  *                     when the gadget is selected, moved and/or left.
  261.  *                     Move message should be used only if your program can
  262.  *                     cope with the amount of messages arriving.
  263.  *
  264.  *   - IntegerGadget : This is an extended string gadget allowing only
  265.  *                     editing of an integer number.
  266.  *
  267.  *   - RealGadget    : Like an integer gadget but for IEEE double precision
  268.  *                     numbers.
  269.  *
  270.  *   - UserDefGadget : A gadget that calls user functions on activation,
  271.  *                     release and on any requested IDCMP event that
  272.  *                     occurs in between.
  273.  *
  274.  *   - MasterGadget  : A gadget that serves as handle for several other gadgets
  275.  *                     that are linked to it. Gadget operations that are
  276.  *                     executed for the master gadget are also recursivly
  277.  *                     called for all its son gadgets. By using the callback
  278.  *                     feature in the gadget structure, one can even build
  279.  *                     complex gadgets, consisting of several normal gadgets,
  280.  *                     but appearing as being one normal gadget.
  281.  *                     See also "egsgadbox..." for examples and more
  282.  *                     information.
  283.  *
  284.  *---------------------------------------------------------------------------
  285.  *
  286.  * Structures:
  287.  *
  288.  * All gadgets own the same basic structure and have then additional elements
  289.  * depending on their type.
  290.  *
  291.  * Gadget, GadgetPtr
  292.  *
  293.  *   .Prev,
  294.  *   .Next          : Chaining of the gadgets, the first and last element of
  295.  *                    a list always point to NIL.
  296.  *   .LeftEdge,
  297.  *   .TopEgde       : Coordinates of the top left corner.
  298.  *   .Width,
  299.  *   .Height        : Gadget size.
  300.  *   .Id            : Identification number.
  301.  *   .Active        : Render program drawing the gadget if it is active.
  302.  *   .Passive       : Render program drawing the gadget if it is passive.
  303.  *                    If this routine is NULL the library uses a ghosting
  304.  *                    mechanism for displaying deactivated gadgets.
  305.  *   .Select        : Render program executed when the gadget is selected.
  306.  *                    The program is passed over the width (in FP+1) and
  307.  *                    height (in FP+0) of the item so that several gadgets
  308.  *                    can share the same program.  If it is a PropGadget then
  309.  *                    the size of the KNOB (in FP+0) or the height of the
  310.  *                    knob for vertical PropGadget (in FP+0) is passed over !
  311.  *   .Release       : Render program called when the gadget is released.
  312.  *                    The program is passed over the item size, too. It is
  313.  *                    called even when the gadget is drawn so that at the
  314.  *                    beginning it is deselected. For PropGadgets this programm
  315.  *                    is called for the KNOB when the gadget is passive.
  316.  *
  317.  *   .Flags         : Gadget flags.
  318.  *
  319.  *     - GADGET_BORDER   : Gadget is in the window border.
  320.  *     - REL_RIGHT       : Gadget coordinates are relative to the right window
  321.  *                         border.
  322.  *     - REL_BOTTOM      : Gadget coordinates are relative to the bottom
  323.  *                         window border.
  324.  *     - SYS_GADGET      : It is a system gadget.
  325.  *     - GADGET_SELECTED : Gadget is currently selected.
  326.  *     - REL_VERIFY      : Gadget sends message only if the pointer was over
  327.  *                         it when the mouse button was released.
  328.  *     - GADGET_IMMEDIATE: Gadget sends message as soon as clicked onto.
  329.  *     - TOGGLE_SELECT   : For bool gadgets, the gadget toggles its state each
  330.  *                         time selected.
  331.  *     - REPEAT_GADGET   : As long as pressed, the gadget sends messages in
  332.  *                         short intervals.
  333.  *     - GADGET_INACTIVE : Gadget cannot be selected.
  334.  *     - STD_HIGHLIGHT   : Gadget gets a standard highlight methode, a 3D
  335.  *                         border.
  336.  *     - STD_COMPLEMENT  : Gadget gets a standard highlight method by inverting
  337.  *                         the gadget area.
  338.  *
  339.  *   .Type          : Gadget's type.
  340.  *   .HotKey        : Character that the user can use to activate/toggle..
  341.  *                    the gadget. A null byte stands for no activating key.
  342.  *   .Call          : Function called before the gadget sends its message.
  343.  *                    The function gets a message pointer in A1 and may change
  344.  *                    the message to its gusto.  If the message's EIDCMP flags
  345.  *                    are cleared, the message is not sent.
  346.  *   .UserData      : Free for user data (wonderful).
  347.  *
  348.  *
  349.  * BoolGadget:
  350.  *
  351.  *   .Flag          : Flag set or cleared corresponding to the gadget state.
  352.  *   .Exclude,
  353.  *   .Include       : Arrays of pointer to boolgadgets, that shall change their
  354.  *                    state if this gadget is activated.
  355.  *
  356.  * StringGadget:
  357.  *
  358.  *   .Buffer        : Pointer to a buffer containing the text.  The text
  359.  *                    terminates with a null byte and can be read from this
  360.  *                    buffer after processing.
  361.  *   .UndoBuffer    : Pointer to undo buffer.  The undo buffer must be at
  362.  *                    least as big as the original buffer.  Selecting the
  363.  *                    gadget copies the buffer's contents into the undo
  364.  *                    buffer.  By pressing Amiga-O the undo buffer is copied
  365.  *                    into the original buffer.
  366.  *   .BufferPos     : Cursor posititon in the text buffer.
  367.  *   .MaxChars      : Maximum characters in the buffer.
  368.  *   .numChars      : Contains during and after processing the number of
  369.  *                    characters in the buffer.
  370.  *   .UndoPos       : Cursor position in the undo buffer.
  371.  *
  372.  *   .Justify       : Specifies if the text is to appear on the left, right
  373.  *                    or in the center of the gadget box.
  374.  *   .Font          : EFont to use for editing, must be non proportional
  375.  *
  376.  *
  377.  *  The programs "select" and "release" have no function for string gadgets
  378.  *  as then the activity is indicated by the visible cursor.
  379.  *
  380.  *
  381.  * PropGadget:
  382.  *
  383.  *   .Propflags     : Gadget flags:
  384.  *
  385.  *     - PROP_HORIZ      : Gadget moves horizontally if this bit is set, else
  386.  *                        vertically.
  387.  *     - PROP_FOLLOW     : The program gest a new message each time the knob
  388.  *                        moves.  You should use this flag with care as
  389.  *                        messages are sent frequently.
  390.  *     - PROP_BORDER     : The gadget is resized automatically if the window
  391.  *                        is resized.
  392.  *     - PROP_MOVES      : The gadget's knob is currently being moved.
  393.  *
  394.  *
  395.  *   .Maximum       : Maximum gadget value.
  396.  *   .Size          : Knob size in gadget units.
  397.  *   .Value         : Value of the gadget.
  398.  *
  399.  *  The programs "active"/"passive" should draw the gadget border.
  400.  *  The programs "select"/"release" are called to draw the knob and are passed
  401.  *  over the knob width (the knob height for vertical PropGadgets).
  402.  *  Example:  .maximum contains 1000.  Then .value and .size must be in the
  403.  *  range from 0 to 1000.  If one fifth of the data is visible, then .size
  404.  *  is 1000/5 = 200 and the maximum value for .value is 800.
  405.  *
  406.  *
  407.  * IntegerGadget, RealGadget:
  408.  *
  409.  *   .Value         : Value after editing is finished.
  410.  *   .Valid         : Flag set after editing is finished.
  411.  *
  412.  *
  413.  * UserGadget:
  414.  *
  415.  *   SelectCall     : Function to be called, when the gadget is selected,
  416.  *                    or NULL for no call, same parameters as .call.
  417.  *   ReleaseCall    : Function to be called, if the gadget is released,
  418.  *                    or NULL for no call, same parameters as .call.
  419.  *   ActionCall     : Function to be called, when the gadget is active and
  420.  *                    and event specified in .callFlags occurs.
  421.  *
  422.  * MasterGadget:
  423.  *
  424.  *   MasterType     : Custom type identifier for this gadget.
  425.  *   FirstSon       : Pointer to first secondary gadget
  426.  *   NumSons        : Number of secondary gadgets
  427.  *
  428.  *
  429.  */
  430.  
  431. /* Corresponding GadgetFlagSet has 16 bits ! */
  432.  
  433. #define EI_GADGET_BORDER    (1<<0)
  434. #define EI_REL_RIGHT        (1<<1)
  435. #define EI_REL_BOTTOM       (1<<2)
  436. #define EI_SYS_GADGET       (1<<3)
  437. #define EI_GADGET_SELECTED  (1<<4)
  438. #define EI_REL_VERIFY       (1<<5)
  439. #define EI_GADGET_IMMEDIATE (1<<6)
  440. #define EI_TOGGLE_SELECT    (1<<7)
  441. #define EI_REPEAT_GADGET    (1<<8)
  442. #define EI_GADGET_INACTIVE  (1<<9)
  443. #define EI_STD_HIGHLIGHT    (1<<10)
  444. #define EI_STD_COMPLEMENT   (1<<11)
  445. #define EI_OLD_SELECT       (1<<12)
  446. #define EI_CALL_ON_ELSEKEY  (1<<13)
  447. #define EI_CALL_ON_ANYKEY   (1<<14)
  448.  
  449. #define EI_ACTION_GADGET       0
  450. #define EI_BOOL_GADGET         1
  451. #define EI_STRING_GADGET       2
  452. #define EI_PROP_GADGET         3
  453. #define EI_INTEGER_GADGET      4
  454. #define EI_USERDEF_GADGET      5
  455. #define EI_MASTER_GADGET       6
  456. #define EI_REAL_GADGET         7
  457.  
  458.  
  459. typedef struct EI_Gadget *EI_GadgetPtr;
  460.  
  461. typedef APTR EI_GadgetCall;
  462.  
  463. /* Obsolete */
  464.  
  465. typedef struct EI_GadgetClass *EI_GadgetClassPtr;
  466.  
  467. struct EI_Gadget {
  468.  
  469.           EI_GadgetPtr             PrevGadget, NextGadget;
  470.  
  471.           WORD                     CheckLeft, CheckTop,
  472.                        LeftEdge,  TopEdge,
  473.                        Width,     Height;
  474.  
  475.           LONG                     GadgetID;
  476.           IG_IntuiGfxPtr           Active, Passive,
  477.                        Select, Release;
  478.  
  479.           UWORD                    Flags;
  480.           UBYTE                    GadgetType;
  481.           char                     HotKey;
  482.           EI_GadgetCall            Call;
  483. /* You get the message in A1, and have to adhere to standard calling
  484.  * convention (A0/A1, D0/D1 are scratch).
  485.  */
  486.           APTR                     UserData;
  487. };
  488.  
  489. typedef struct EI_Gadget EI_GadgetClass;
  490. typedef struct EI_BoolGadget *EI_BoolGadPtr;
  491. typedef EI_BoolGadPtr EI_GadgetArray;
  492. typedef EI_GadgetArray *EI_GadgetArrayPtr;
  493.  
  494. struct EI_BoolGadget {
  495.  
  496.           struct EI_Gadget   Class;
  497.           UBYTE              Flag;
  498.           UBYTE              Pad_1, Pad_2, Pad_3;
  499.           EI_GadgetArrayPtr  Exclude, Include;
  500. };
  501.  
  502.  
  503. /* Corresponding EI_PropFlagSet has 16 bits ! */
  504.  
  505. #define EI_PROP_HORIZ           1
  506. #define EI_PROP_FOLLOW          2
  507. #define EI_PROP_MOVES           4
  508. #define EI_PROP_BORDER          8
  509. #define EI_PROP_DELTA_REFRESH   16
  510.  
  511. /* Optimized refresh (described below) */
  512.  
  513. typedef struct EI_PropGadget *EI_PropGadPtr;
  514.  
  515. struct EI_PropGadget {
  516.  
  517.           struct EI_Gadget  Class;
  518.           UWORD             Propflags;
  519.           WORD              Maximum, Size, Value;
  520.           WORD              V_height, V_pos;
  521. };
  522.  
  523. /*********************************************************
  524.  *
  525.  *  These are examples of prop-gadget IntuiGfx programs for
  526.  *  rendering.
  527.  *
  528.  *  The PropBorder program must then be put in the field called
  529.  *  Active. This program renders the full border of the gadget
  530.  *  and clears the interior.
  531.  *
  532.  *  IG_IntuiGfx PropBorder[] = {
  533.  *      IG_Const-1,IG_Const-1,IG_Move,
  534.  *      IG_CNormal,IG_CLight,IG_CDark,
  535.  *      IG_GETFI+1,IG_ADDI+2,
  536.  *      IG_GETFI+0,IG_ADDI+2,
  537.  *      IG_Rect3d,IG_RTF+2 };
  538.  *
  539.  *  These are the knob programs for verical and horizontal prop-gadgets,
  540.  *  respectively. They are put into the Select field in the EI_Gadget
  541.  *  structure.
  542.  *
  543.  *  IG_IntuiGfx VPropKnobb[] = {
  544.  *      IG_CNormal, IG_CDark,   IG_CLight,
  545.  *      IG_GETFI+1, IG_GETFI+0,
  546.  *      IG_Rect3d,
  547.  *      IG_RTF+2 };
  548.  *
  549.  *  IG_IntuiGfx HPropKnobb[] = {
  550.  *      IG_CNormal, IG_CDark, IG_CLight,
  551.  *      IG_GETFI+0, IG_GETFI+1,
  552.  *      IG_Rect3d,  IG_RTF+2 };
  553.  *
  554.  *  If you want an optimized refresh for the knob, you have to set
  555.  *  the flag EI_PROP_DELTA_REFRESH and put a program into the Release
  556.  *  field. The program PropDeltaB[] below is an example of this.
  557.  *
  558.  *  IG_IntuiGfx PropDeltaB[] = {
  559.  *      IG_CNormal, IG_Color,
  560.  *      IG_GETFI+1, IG_GETFI+0,
  561.  *      IG_Box,     IG_RTF+2 };
  562.  *
  563.  *
  564.  **********************************************************/
  565.  
  566. /* Enumeration type EI_StringJustify has 8 bits ! */
  567.  
  568. #define EI_JUSTIFY_LEFT   0
  569. #define EI_JUSTIFY_RIGHT  1
  570. #define EI_JUSTIFY_CENTER 2
  571.  
  572. typedef struct EI_StringGadget *EI_StringGadPtr;
  573.  
  574. struct EI_StringGadget {
  575.  
  576.           struct EI_Gadget   Class;
  577.           char              *Buffer, *UndoBuffer;
  578.           WORD               BufferPos, MaxChars,
  579.                      DispPos, UndoPos,
  580.                      NumChars, DispCount,
  581.                      DispFront;
  582.           WORD               CLeft, CTop;
  583.           UBYTE              Justify;
  584.           UBYTE              Pad;
  585.           EG_EFontPtr        Font;
  586. };
  587.  
  588. typedef struct EI_IntGadget *EI_IntGadPtr;
  589.  
  590. struct EI_IntGadget {
  591.            struct EI_StringGadget  SG;
  592.            LONG                    Value;
  593.            UBYTE                   Valid;
  594.            UBYTE                   Pad;
  595. };
  596.  
  597. typedef struct EI_UserGadget *EI_UserGadPtr;
  598.  
  599. struct EI_UserGadget {
  600.  
  601.            struct EI_Gadget  Class;
  602.            EI_GadgetCall     SelectCall,
  603.                      ReleaseCall,
  604.                      ActionCall;
  605.            /* IDCMPFlags to respond to for ActionCall: */
  606.            ULONG             CallFlags;
  607. };
  608. /* You get the message in A1, and have to adhere to standard calling
  609.  * convention (A0/A1, D0/D1 are scratch).
  610.  */
  611.  
  612. typedef struct EI_MasterGadget *MasterGadPtr;
  613.  
  614. struct EI_MasterGadget {
  615.  
  616.             struct EI_Gadget  Class;
  617.             LONG              MasterType;
  618.             EI_GadgetPtr      FirstSon;
  619.             WORD              NumSons;
  620.             WORD              Pad;
  621. };
  622.  
  623. typedef struct EI_RealGadget *RealGadPtr;
  624.  
  625. struct EI_RealGadget {
  626.             struct EI_StringGadget SG;
  627.             double                 Value;
  628.             UBYTE                  Valid;
  629.             UBYTE                  Pad;
  630. };
  631.  
  632.  
  633.  
  634. /*
  635.  * Screens
  636.  *
  637.  * Screens are logical successors of the EGS "EScreens".  They are extended
  638.  * by fields for window and layer support.
  639.  *
  640.  * If no windows are needed it does not pay to use the screens from this
  641.  * module as they have some overhead.  Moreover, EGSIntui screens cannot
  642.  * catch and redirect events.
  643.  *
  644.  *---------------------------------------------------------------------------
  645.  *
  646.  * Structures:
  647.  *
  648.  * NewScreen
  649.  *
  650.  *   .Mode        : Screen mode, refer to EGS library.
  651.  *   .Depth       : Screen depth, refer to EGS library.
  652.  *   .Title       : Screen title appearing in the title bar.
  653.  *   .Colors      : Screen colours, refer to EGS library.
  654.  *   .WinColors   : Recommended colours for windows.
  655.  *   .BackPen     : Screen background pen.
  656.  *   .BackPattern : Background pattern or picture for the screen.
  657.  *   .Mouse       : Standard mouse pointer for the screen.
  658.  *   .Font        : Font for screens and windows titlebar, if NULL the
  659.  *                  default fonts are used
  660.  *   .Flags       : The new screens screenflags
  661.  *
  662.  * Screen,ScreenPtr
  663.  *
  664.  *   .Front,
  665.  *   .Back        : Chaining.
  666.  *   .EScreen     : Pointer to the EScreen structure.
  667.  *   .FirstWindow
  668.  *   .LastWindow  : Pointer to the screen's windows.
  669.  *   .RastPort    : Screen RastPort.
  670.  *   .Info        : Pointer to LayerInfo structure.
  671.  *   .BarLayer    : Pointer to layer of the title bar.
  672.  *   .BarRast     : Pointer to screen's RastPort.
  673.  *   .WinColors   : Recommended window colours of the screen.
  674.  *   .Width       : Screen width.
  675.  *   .Height      : Screen height.
  676.  *   .Title       : Pointer to screen title string (beware, a Cluster string).
  677.  *   .Mouse       : Pointer to standard mouse pointer of screen.
  678.  *   .Font        : The title font of the screen
  679.  *   .Flags       : The screens flags
  680.  *
  681.  */
  682.  
  683. typedef APTR EI_ColorLock;
  684. typedef APTR EI_ColorTablePtr;
  685.  
  686. /* Corresponding EI_ScreenFlagSet has 8 bits */
  687. #define EI_SCREENQUIET  1
  688. #define EI_SCREENBEHIND 2
  689.  
  690. typedef struct EI_Screen *EI_ScreenPtr;
  691.  
  692. struct EI_NewScreen {
  693.         char                 *Mode;
  694.         WORD                  Depth;
  695.         UWORD                 Pad_1;
  696.         char                 *Title;
  697.         E_CLUPtr              Colors;
  698.         struct IG_WinColors   WinColors;
  699.         LONG                  BackPen;
  700.         E_EBitMapPtr          BackPattern;
  701.         E_EMousePtr           Mouse;
  702.         struct TextAttr      *Font;
  703.         UBYTE                 Flags;
  704.         UBYTE                 Pad;
  705. };
  706.  
  707. struct EI_Screen {
  708.         EI_ScreenPtr          Front, Back;
  709.         E_EScreenPtr          EScreen;
  710.         EI_WindowPtr          FirstWindow, LastWindow;
  711.         EG_RastPortPtr        RastPort;
  712.         EL_LayerInfoPtr       LayerInfo;
  713.         EL_LayerPtr           BarLayer;
  714.         EG_RastPortPtr        BarRast;
  715.         struct IG_WinColors   WinColors;
  716.         WORD                  Width, Height;
  717.         APTR                  Title;
  718.         E_EMousePtr           Mouse;
  719.         EG_EFontPtr           Font;
  720.         WORD                  GadSize;
  721.         UWORD                 Pad1;
  722.         APTR                  GadImages;
  723.         UBYTE                 Flags;
  724.         UBYTE                 Pad2,Pad3,Pad4;
  725.         EG_EFontPtr           WindowFont;
  726.         APTR                  SGadImage;
  727.         EI_ColorTablePtr      Colors;
  728.         EI_ColorLock          ColorLock;
  729.         APTR                  UpGadImages;
  730. };
  731.  
  732. /*
  733.  * Colortags
  734.  */
  735.  
  736. #define EI_CTAGBASE            0x80010000
  737. #define EIC_SCREEN_BACKPEN     (EI_CTAGBASE+0x00)
  738. #define EIC_WINDOW_BACKPEN     (EI_CTAGBASE+0x01)
  739. #define EIC_UNKNWON_PEN        (EI_CTAGBASE+0x02)
  740. #define EIC_TEXT_FRONT_PEN     (EI_CTAGBASE+0x03)
  741. #define EIC_TEXT_BACK_PEN      (EI_CTAGBASE+0x04)
  742. #define EIC_SCREENLIGHT        (EI_CTAGBASE+0x05)
  743. #define EIC_SCREEN_PEN         (EI_CTAGBASE+0x06)
  744. #define EIC_SCREEN_DARK        (EI_CTAGBASE+0x07)
  745. #define EIC_SCREEN_TEXT        (EI_CTAGBASE+0x08)
  746. #define EIC_WIN_LIGHT          (EI_CTAGBASE+0x09)
  747. #define EIC_WIN_PEN            (EI_CTAGBASE+0x0A)
  748. #define EIC_WIN_DARK           (EI_CTAGBASE+0x0B)
  749. #define EIC_WIN_TEXT           (EI_CTAGBASE+0x0C)
  750. #define EIC_WIN_ACTIVE_LIGHT   (EI_CTAGBASE+0x0D)
  751. #define EIC_WIN_ACTIVE_PEN     (EI_CTAGBASE+0x0E)
  752. #define EIC_WIN_ACTIVE_DARK    (EI_CTAGBASE+0x0F)
  753. #define EIC_WIN_ACTIVE_TEXT    (EI_CTAGBASE+0x10)
  754. #define EIC_WIN_SLEEP_LIGHT    (EI_CTAGBASE+0x11)
  755. #define EIC_WIN_SLEEP_PEN      (EI_CTAGBASE+0x12)
  756. #define EIC_WIN_SLEEP_DARK     (EI_CTAGBASE+0x13)
  757. #define EIC_WIN_SLEEP_TEXT     (EI_CTAGBASE+0x14)
  758. #define EIC_GADGET_LIGHT       (EI_CTAGBASE+0x15)
  759. #define EIC_GADGET_PEN         (EI_CTAGBASE+0x16)
  760. #define EIC_GADGET_DARK        (EI_CTAGBASE+0x17)
  761. #define EIC_GADGET_TEXT        (EI_CTAGBASE+0x18)
  762. #define EIC_GADGET_SEL_LIGHT   (EI_CTAGBASE+0x19)
  763. #define EIC_GADGET_SEL_PEN     (EI_CTAGBASE+0x1A)
  764. #define EIC_GADGET_SEL_DARK    (EI_CTAGBASE+0x1B)
  765. #define EIC_GADGET_SEL_TEXT    (EI_CTAGBASE+0x1C)
  766. #define EIC_TEXT_GADGET_FRONT  (EI_CTAGBASE+0x1D)
  767. #define EIC_TEXT_GADGET_BACK   (EI_CTAGBASE+0x1E)
  768. #define EIC_PROP_LIGHT         (EI_CTAGBASE+0x1F)
  769. #define EIC_PROP_PEN           (EI_CTAGBASE+0x20)
  770. #define EIC_PROP_DARK          (EI_CTAGBASE+0x21)
  771. #define EIC_KNOB_LIGHT         (EI_CTAGBASE+0x22)
  772. #define EIC_KNOB_PEN           (EI_CTAGBASE+0x23)
  773. #define EIC_KNOB_DARK          (EI_CTAGBASE+0x24)
  774. #define EIC_MENU_LIGHT         (EI_CTAGBASE+0x25)
  775. #define EIC_MENU_PEN           (EI_CTAGBASE+0x26)
  776. #define EIC_MENU_DARK          (EI_CTAGBASE+0x27)
  777. #define EIC_MENU_TEXT          (EI_CTAGBASE+0x28)
  778. #define EIC_MENU_SEL_LIGHT     (EI_CTAGBASE+0x29)
  779. #define EIC_MENU_SEL_PEN       (EI_CTAGBASE+0x2A)
  780. #define EIC_MENU_SEL_DARK      (EI_CTAGBASE+0x2B)
  781. #define EIC_MENU_SEL_TEXT      (EI_CTAGBASE+0x2C)
  782. #define EIC_MASTER_LIGHT       (EI_CTAGBASE+0x2D)
  783. #define EIC_MASTER_PEN         (EI_CTAGBASE+0x2E)
  784. #define EIC_MASTER_DARK        (EI_CTAGBASE+0x2F)
  785. #define EIC_MASTER_TEXT        (EI_CTAGBASE+0x30)
  786. #define EIC_WIN_GADGET_LIGHT   (EI_CTAGBASE+0x31)
  787. #define EIC_WIN_GADGET_DARK    (EI_CTAGBASE+0x32)
  788. #define EIC_WIN_GADGET_BACK    (EI_CTAGBASE+0x33)
  789. #define EIC_WIN_GADGET_PEN     (EI_CTAGBASE+0x34)
  790. #define EIC_TEXT_SELECT_FRONT_PEN   (EI_CTAGBASE+0x35)
  791. #define EIC_TEXT_SELECT_BACK_PEN    (EI_CTAGBASE+0x36)
  792. #define EIC_CURSOR_FRONT_PEN        (EI_CTAGBASE+0x37)
  793. #define EIC_CURSOR_BACK_PEN         (EI_CTAGBASE+0x38)
  794. #define EIC_CURSOR_SELECT_FRONT_PEN (EI_CTAGBASE+0x39)
  795. #define EIC_CURSOR_SELECT_BACK_PEN  (EI_CTAGBASE+0x3A)
  796. #define EIC_CURSOR_INACTIVE_FRONT_PEN (EI_CTAGBASE+0x3B)
  797. #define EIC_CURSOR_INACTIVE_BACK_PEN  (EI_CTAGBASE+0x3C)
  798.  
  799.  
  800. #define EI_MTAGBASE             0x80020000
  801. #define EIM_STANDARD_MOUSE     (EI_MTAGBASE+0x00)
  802. #define EIM_SLEEP_MOUSE        (EI_MTAGBASE+0x01)
  803. #define EIM_WAIT_MOUSE         (EI_MTAGBASE+0x02)
  804. #define EIM_DISK_READ_MOUSE    (EI_MTAGBASE+0x03)
  805. #define EIM_DISK_WRITE_MOUSE   (EI_MTAGBASE+0x04)
  806. #define EIM_DISKIO_MOUSE       (EI_MTAGBASE+0x05)
  807. #define EIM_WORKING_MOUSE      (EI_MTAGBASE+0x06)
  808. #define EIM_PLAY_MACRO_MOUSE   (EI_MTAGBASE+0x07)
  809. #define EIM_PRINTING_MOUSE     (EI_MTAGBASE+0x08)
  810. #define EIM_SEARCHING_MOUSE    (EI_MTAGBASE+0x09)
  811. #define EIM_FROZEN_MOUSE       (EI_MTAGBASE+0x0A)
  812. #define EIM_COPY_MOUSE         (EI_MTAGBASE+0x0B)
  813. #define EIM_SWAP_MOUSE         (EI_MTAGBASE+0x0C)
  814. #define EIM_MOVE_MOUSE         (EI_MTAGBASE+0x0D)
  815. #define EIM_SELECT_MOUSE       (EI_MTAGBASE+0x0E)
  816. #define EIM_ZOOM_MOUSE         (EI_MTAGBASE+0x0F)
  817. #define EIM_FILL_MOUSE         (EI_MTAGBASE+0x10)
  818. #define EIM_PASTE_MOUSE        (EI_MTAGBASE+0x11)
  819. #define EIM_CUT_MOUSE          (EI_MTAGBASE+0x12)
  820. #define EIM_RECORD_MACRO_MOUSE (EI_MTAGBASE+0x13)
  821. #define EIM_CROSSHAIR_MOUSE    (EI_MTAGBASE+0x14)
  822. #define EIM_SIZE_MOUSE         (EI_MTAGBASE+0x15)
  823. #define EIM_TEXT_MOUSE         (EI_MTAGBASE+0x16)
  824. #define EIM_AIRBRUSH_MOUSE     (EI_MTAGBASE+0x17)
  825. #define EIM_PICK_MOUSE         (EI_MTAGBASE+0x18)
  826. #define EIM_DRAW_MOUSE         (EI_MTAGBASE+0x19)
  827. #define EIM_PAINT_MOUSE        (EI_MTAGBASE+0x1A)
  828. #define EIM_SELECT_TO_MOUSE    (EI_MTAGBASE+0x1B)
  829. #define EIM_RANGE_MOUSE        (EI_MTAGBASE+0x1C)
  830. #define EIM_CLICK_MOUSE        (EI_MTAGBASE+0x1D)
  831. #define EIM_ROTATE_MOUSE       (EI_MTAGBASE+0x1E)
  832.  
  833. /*
  834.  * Windows
  835.  *
  836.  * Windows use layers, RastPorts and screens.  They are the super structure
  837.  * of gadgets and menus.  If required, they send messages about user actions
  838.  * and other events.
  839.  *
  840.  * A window consists of one or two layers (GimmeZeroZero).  The overhead of
  841.  * the second layer is not as big as to destroy the advantage of automatic
  842.  * clipping.  Only simple requester windows without a sizing gadget should
  843.  * be implemented with one-layered windows.
  844.  *
  845.  * Windows can have a render program being executed automatically at refresh
  846.  * by the library.  This frees the program from refreshing constant graphics
  847.  * elements.
  848.  *
  849.  *---------------------------------------------------------------------------
  850.  *
  851.  * Structures:
  852.  *
  853.  * EIntuiMsg, EIntuiMsgPtr
  854.  *
  855.  *   .class      : Type of message:
  856.  *
  857.  *     - iMOUSEBUTTONS  : Mouse button message; which button and whether
  858.  *                        pressed or released is contained in the code field.
  859.  *     - iMOUSEMOVE     : Mouse movement.
  860.  *     - iRAWKEY        : "Raw" key message, i.e. scan code and qualifier.
  861.  *                        If VanillaKey is also selected, normal key are
  862.  *                        reported as Vanillakey and control keys as RawKey
  863.  *                        message (like 2.0).
  864.  *     - iACTIVATE      : Window was activated.
  865.  *     - iWINDOWREFRESH : Window wants a refresh, the refresh key (refer to
  866.  *                        EGSLayers) is in the field "iAddress".
  867.  *     - iCLOSEWINDOW   : User has clicked onto the close gadget.
  868.  *     - iNEWSIZE       : Window was resized.
  869.  *     - iMENUPICK      : Menu item has been selected.
  870.  *     - iGADGETUP      : Gadget was selected.
  871.  *     - iVANILLakEY    : Message about translated key press, the ASCII code
  872.  *                        of the key is in the code field.
  873.  *     - iSIZEVERIFY    : If the user tries to resize the window, a SizeVerify
  874.  *                        message is sent.  EGSIntui waits until the message
  875.  *                        is replied.  The program can cancel the sizing
  876.  *                        action with the corresponding message in the code
  877.  *                        field.
  878.  *     - iDISKINSERTED  : Self-explanatory.
  879.  *     - iDISKREMOVED   : Self-explanatory.
  880.  *     - iNEWPREFS      : The Amiga preferences were changed.
  881.  *
  882.  *   .Code       : Additional information about the message.
  883.  *   .Qualifier  : State of the qualifiers (shift etc.) when the event was
  884.  *                 sent.
  885.  *   .IAddress   : Address of the structure that caused the event (gadget or
  886.  *                 menu).
  887.  *   .MouseX,
  888.  *   .MouseY     : Mouse position at event time, relative to top left corner
  889.  *                 of the window.
  890.  *   .Seconds,
  891.  *   .Micros     : Event time.
  892.  *   .IDCMPWindow: Window sending the message.
  893.  *
  894.  * NewWindow
  895.  *
  896.  *   .LeftEdge,
  897.  *   .TopEdge    : Top left window corner.
  898.  *   .Width,
  899.  *   .Height     : Size of window's contents.
  900.  *   .MinWidth,
  901.  *   .MinHeight  : Minimum window size.
  902.  *   .MaxWidth,
  903.  *   .MaxHeight  : Maximum window size.
  904.  *   .Screen     : Screen on which the window shall open.  If NIL is speci-
  905.  *                 fied, the window is opened on a standard screen.  The
  906.  *                 program should make no assumptions regarding the screen,
  907.  *                 neither size nor depth.
  908.  *   .SysGadgets : System gadgets of the window:
  909.  *
  910.  *     - WINDOWCLOSE     : Close gadget.
  911.  *     - WINDOWSIZE      : Size gadget in the bottom right corner.
  912.  *     - WINDOWFRONT     : Gadget for window-to-front.
  913.  *     - WINDOWBACK      : Gadget for window-to-back; if only one of both
  914.  *                         gadgets is there it serves for both purposes just
  915.  *                         like Kick 2.0.
  916.  *     - WINDOWFLIP      : Flipping between two positions and sizes like
  917.  *                         Kick 2.0.
  918.  *     - WINDOWBIG       : Gadget for maximum size.
  919.  *     - WINDOWSMALL     : Gadget for minimum size.
  920.  *     - WINDOWICON      : Iconify.
  921.  *     - WINDOWARROWL,
  922.  *     - WINDOWARROWR,
  923.  *     - WINDOWARROWU,
  924.  *     - WINDOWARROWD    : Arrows for scrolling gadgets.
  925.  *     - WINDOWSCROLLH,
  926.  *     - WINDOWSCROLLV   : Scrolling gadgets for the window.
  927.  *     - WINDOWDRAG      : Dragging gadget.
  928.  *
  929.  *   .Gadgets    : List of gadgets that the window is to have from the
  930.  *                 beginning.
  931.  *   .Name       : Window title.
  932.  *   .Flags      : Window flags (what else ?).
  933.  *
  934.  *     - GIMMEZEROZERO   : GZZ window with two layers and extra RastPort for
  935.  *                         inner area and the border.
  936.  *     - BORDERLESS      : Window has no border and cannot be moved.
  937.  *     - SUPERBITMAP     : Window gets a SuperBitMap layer, all initializing
  938.  *                         is done automatically, the size of the SuperBitMap
  939.  *                         is derived from the maximum window size.
  940.  *     - SIMPLEREFRESH   : User gets messages about refreshs.
  941.  *     - WINDOWACTIVE    : Window is currently active.
  942.  *     - WINDOWMENUlOCAL : Window menu is relative to the window title.
  943.  *     - OWNCOLORPALETTE : Window has a colour table on its own for its
  944.  *                         border etc.
  945.  *     - RMBTRAP         : If not pressed outside the window, a message is
  946.  *                         sent for the right mouse button instead of
  947.  *                         starting menu selection.
  948.  *     - REPORTMOUSE     : The mouse position is in intervals written into
  949.  *                         the window structure.  This flag is neccessary to
  950.  *                         get MouseMove events.
  951.  *     - BACKDROP        : The window is opened behind all other windows.
  952.  *     - SMARTREFRESH    : The window automatically refreshes itself in most
  953.  *                         cases apart from resizing.
  954.  *     - WINDOWMENUPOPUP : This window's menus appear directly at the mouse
  955.  *                         position.
  956.  *     - WINDOWSIZEBOTTOM: The window sizing gadget belongs only to the bottom
  957.  *                         border.
  958.  *     - WINDOWSIZERIGHT : The window sizing gadget belongs only to the right
  959.  *                         border.
  960.  *     - WINDOWUSERSTYLE : The window has its own rendering routine for its
  961.  *                         borders and gadgets
  962.  *     - ACTIVETOFRONT   : The window always comes to the front, when it is
  963.  *                         activated.
  964.  *     - QUICKSCROLL     : The window offset follows immediately the scroll-
  965.  *                         ing gadgets
  966.  *     - FIXWINDOWRATIO  : The window keeps the width/height ratio according
  967.  *                         to the maximum size, when resized by the user.
  968.  *
  969.  *   .IDCMPFlags : Events to be sent by the window.
  970.  *   .UserPort   : Pointer to a message port for user actions.  If the pointer
  971.  *                 is NIL the library creates an extra port and removes that
  972.  *                 port when closing the window.
  973.  *   .Colors     : Own colour table for border and text.
  974.  *   .MenuStrip  : Pointer to window menu.
  975.  *   .Render     : Render program to draw the standard window contents.
  976.  *
  977.  * Window, WindowPtr
  978.  *
  979.  *   .LeftEdge,
  980.  *   .TopEdge    : Top left window corner.
  981.  *   .Width,
  982.  *   .Height     : Size of the inner window parts.
  983.  *   .LeftBorder,
  984.  *   .TopBorder,
  985.  *   .RightBorder,
  986.  *   .BottomBorder : Width or height of the window border.
  987.  *   .RPort      : RastPort of the window contents.
  988.  *   .Layer      : Layer of the window.
  989.  *   .Screen     : Pointer to the window's screen.
  990.  *   .MouseX,
  991.  *   .MouseY     : The mouse position relative to the top left window edge
  992.  *   .UserPort   : The windows message port
  993.  */
  994.  
  995. /* Corresponding EI_SysGadgetSet has 32 bits ! */
  996.  
  997. #define EI_WINDOWCLOSE   (1<<0)
  998. #define EI_WINDOWSIZE    (1<<1)
  999. #define EI_WINDOWFRONT   (1<<2)
  1000. #define EI_WINDOWBACK    (1<<3)
  1001. #define EI_WINDOWFLIP    (1<<4)
  1002. #define EI_WINDOWBIG     (1<<5)
  1003. #define EI_WINDOWSMALL   (1<<6)
  1004. #define EI_WINDOWICON    (1<<7)
  1005. #define EI_WINDOWARROWL  (1<<8)
  1006. #define EI_WINDOWARROWR  (1<<9)
  1007. #define EI_WINDOWARROWU  (1<<10)
  1008. #define EI_WINDOWARROWD  (1<<11)
  1009. #define EI_WINDOWSCROLLH (1<<12)
  1010. #define EI_WINDOWSCROLLV (1<<13)
  1011. #define EI_WINDOWDRAG    (1<<14)
  1012.  
  1013. /* Corresponding EI_WindowFlagSet has 32 bits ! */
  1014.  
  1015. #define EI_GIMMEZEROZERO     (1<<0)
  1016. #define EI_BORDERLESS        (1<<1)
  1017. #define EI_SUPER_BITMAP      (1<<2)
  1018. #define EI_SIMPLE_REFRESH    (1<<3)
  1019. #define EI_WINDOWREFRESH     (1<<4)
  1020. #define EI_WINDOWACTIVE      (1<<5)
  1021. #define EI_WINDOW_MENULOCAL  (1<<6)
  1022. #define EI_OWN_IDCMPPORT     (1<<7)
  1023. #define EI_OWN_COLORPALETTE  (1<<8)
  1024. #define EI_FRONTBACKGADGET   (1<<9)
  1025. #define EI_RMBTRAP           (1<<10)
  1026. #define EI_REPORTMOUSE       (1<<11)
  1027. #define EI_BACKDROP          (1<<12)
  1028. #define EI_SMART_REFRESH     (1<<13)
  1029. #define EI_WINDOW_MENUPOPUP  (1<<14)
  1030. #define EI_SIZEBBOTTOM       (1<<15)
  1031. #define EI_SIZEBRIGHT        (1<<16)
  1032. #define EI_WINDOW_USERSTYLE  (1<<17)
  1033. #define EI_ACTIVETOFRONT     (1<<18)
  1034. #define EI_QUICKSCROLL       (1<<19)
  1035. #define EI_WINDOW_SLEEPING   (1<<20)
  1036. #define EI_FIXWINDOW_RATIO   (1<<21)
  1037. #define EI_FORCE_TO_SCREEN   (1<<22)
  1038. #define EI_WINDOWCENTER      (1<<23)
  1039. #define EI_SEND_OUTSIDEMOVES (1<<24)
  1040.  
  1041. /* Corresponding EI_EIDCMPFlagSet has 32 bits ! */
  1042.  
  1043. #define EI_iMOUSEBUTTONS   (1<<0)
  1044. #define EI_iMOUSEMOVE      (1<<1)
  1045. #define EI_iRAWKEY         (1<<2)
  1046. #define EI_iACTIVEWINDOW   (1<<3)
  1047. #define EI_iREFRESHWINDOW  (1<<4)
  1048. #define EI_iCLOSEWINDOW    (1<<5)
  1049. #define EI_iNEWSIZE        (1<<6)
  1050. #define EI_iMENUPICK       (1<<7)
  1051. #define EI_iGADGETDOWN     (1<<8)
  1052. #define EI_iGADGETUP       (1<<8)
  1053. #define EI_iMENUVERIFY     (1<<9)
  1054. #define EI_iVANILLAKEY     (1<<10)
  1055. #define EI_iSIZEVERIFY     (1<<11)
  1056. #define EI_iINACTIVEWINDOW (1<<12)
  1057. #define EI_iINTUITICKS     (1<<13)
  1058. #define EI_iDISKINSERT     (1<<14)
  1059. #define EI_iDISKREMOVE     (1<<15)
  1060. #define EI_iNEWPREFS       (1<<16)
  1061. #define EI_iMOVEWINDOW     (1<<17)
  1062.  
  1063. struct EI_Window {
  1064.          EI_WindowPtr         Front, Back,
  1065.                       Prev, Next, OldActive;
  1066.          WORD                 LeftEdge, TopEdge,
  1067.                       Width, Height;
  1068.          WORD                 BorderLeft, BorderTop,
  1069.                       BorderRight, BorderBottom;
  1070.          WORD                 FullWidth, FullHeight;
  1071.          WORD                 LeftUsed, RightUsed;
  1072.          WORD                 MouseX, MouseY;
  1073.          EG_RastPortPtr       RPort;
  1074.          EL_LayerPtr          WLayer;
  1075.          EI_ScreenPtr         WScreen;
  1076.          EG_RastPortPtr       BorderRPort;
  1077.          EL_LayerPtr          BorderLayer;
  1078.          ULONG                Flags;
  1079.          ULONG                IDCMPFlags;
  1080.          struct MsgPort      *UserPort;
  1081.          EI_GadgetPtr         FirstGadget;
  1082.          EB_ColorTable        GadColors [5];
  1083.          struct IG_WinColors  WinColors;
  1084.          APTR                 Tile, ScrTitel;
  1085.          IG_IntuiGfxPtr       Border, Render;
  1086.          EI_MenuPtr           OuterMenu, MenuStrip;
  1087.          E_EMousePtr          Pointer;
  1088.          WORD                 MinWidth, MinHeight,
  1089.                       MaxWidth, MaxHeight;
  1090.          WORD                 FlipWidth, FlipHeight,
  1091.                       FlipLeft, FlipTop;
  1092.          EG_EFontPtr          EFont;
  1093.          APTR                 UserData;
  1094.          EI_ColorTablePtr     Colors;
  1095.          LONG                 SleepCount;
  1096. };
  1097.  
  1098. struct EI_EIntuiMsg {
  1099.  
  1100.          struct   Message  ExecMessage;
  1101.          ULONG             Class;
  1102.          UWORD             Code;
  1103.          WORD              Qualifier;
  1104.          APTR              IAddress;
  1105.          WORD              MouseX, MouseY;
  1106.          ULONG             Seconds, Micros;
  1107.          EI_WindowPtr      IDCMPWindow;
  1108.          WORD              RepeatCount;  /* Number of repeated keys */
  1109. };
  1110.  
  1111. /*
  1112.  * EI_UserStyle
  1113.  *
  1114.  * Structure for own look window border. Uses an IntuiGfx program to draw.
  1115.  * The parameters are defined as EI_US_xxx. If an own border is given, all
  1116.  * the system gadgets have to be supplied by the programmer too.
  1117.  *
  1118.  * Example, the original egs window border:
  1119.  *
  1120.  * {
  1121.  *  *** black surrounding     ***
  1122.  *   IG_Const24+0x000000,IG_Color,
  1123.  *   EI_US_Width,EI_US_Height,IG_Box2d,
  1124.  *  *** first outer 3d border ***
  1125.  *   IG_Const+1,IG_Const+1,IG_Locate,
  1126.  *   IG_Const24+0x000000,EI_US_Middle,
  1127.  *   EI_US_Width,IG_ADDI-2,
  1128.  *   EI_US_Height,IG_ADDI-2,IG_Box3d,
  1129.  *  *** second outer 3d border ***
  1130.  *   IG_Const+2,IG_Const+2,IG_Locate,
  1131.  *   EI_US_Dark,EI_US_Light,
  1132.  *   EI_US_Width,IG_ADDI-4,
  1133.  *   EI_US_Height,IG_ADDI-4,IG_
  1134.  *  *** first inner 3d border ***
  1135.  *   EI_US_Left,IG_ADDI-1,
  1136.  *   EI_US_Top,IG_ADDI-1,IG_Locate,
  1137.  *   EI_US_Middle,IG_Const24+0x000000,
  1138.  *   EI_US_Width,EI_US_Left,IG_SUB,EI_US_Right,IG_SUB,IG_ADDI+2,
  1139.  *   EI_US_Height,EI_US_Top,IG_SUB,EI_US_Bottom,IG_SUB,IG_ADDI+2,IG_Box3d,
  1140.  *  *** second inner 3d border ***
  1141.  *   EI_US_Left,IG_ADDI-2,
  1142.  *   EI_US_Top,IG_ADDI-2,IG_Locate,
  1143.  *   EI_US_Middle,IG_Const24+0x000000,
  1144.  *   EI_US_Width,EI_US_Left,IG_SUB,EI_US_Right,IG_SUB,IG_ADDI+4,
  1145.  *   EI_US_Height,EI_US_Top,IG_SUB,EI_US_Bottom,IG_SUB,IG_ADDI+4,IG_Box3d,
  1146.  *  *** filled border area, top... ***
  1147.  *   EI_US_Middle,IG_Color,
  1148.  *  *** ... top ... ***
  1149.  *   IG_Const+3,IG_Const+3,IG_Locate,
  1150.  *   EI_US_Width,IG_ADDI-6,EI_US_Top,IG_ADDI-5,IG_Box,
  1151.  *  *** ... right ... ***
  1152.  *   EI_US_Right,IG_ADDI-5,IG_DUP,
  1153.  *   IG_NEG,IG_Const+0,IG_Move,
  1154.  *   EI_US_Height,EI_US_Top,IG_SUB,EI_US_Bottom,IG_SUB,IG_ADDI-4,IG_Box,
  1155.  *  *** ... left ... ***
  1156.  *   IG_Const+3,EI_US_Top,IG_ADDI-2,IG_Locate,
  1157.  *   EI_US_Left,IG_ADDI-5,IG_DUP,
  1158.  *   EI_US_Height,EI_US_Top,IG_SUB,EI_US_Bottom,IG_SUB,IG_ADDI+4,IG_Box,
  1159.  *  *** ... bottom ... ***
  1160.  *   IG_NEG,IG_Const+0,IG_Move,
  1161.  *   EI_US_Width,IG_ADDI-6,EI_US_Bottom,IG_ADDI-5,IG_Box,
  1162.  *  *** ... title ... ***
  1163.  *   EI_US_Font,IG_Font,
  1164.  *   EI_US_FHeight,IG_ADDI+7,IG_Const+6,IG_Locate,
  1165.  *   EI_US_TextColor,IG_Color,EI_US_Name,IG_Write,
  1166.  *  *** good bye ***
  1167.  *   IG_RTF+13
  1168.  *  }
  1169.  *
  1170.  */
  1171.  
  1172. typedef struct EI_UserStyle *EI_UserStylePtr;
  1173.  
  1174. #define EI_US_TEXTCOLOR    (IG_GETFI+12)  /* color of title text          */
  1175. #define EI_US_LEFT         (IG_GETFI+11)  /* width of left border         */
  1176. #define EI_US_TOP          (IG_GETFI+10)  /* height of top border         */
  1177. #define EI_US_RIGHT        (IG_GETFI+9)   /* width of right border        */
  1178. #define EI_US_BOTTOM       (IG_GETFI+8)   /* height of bottom border      */
  1179. #define EI_US_FONT         (IG_GETFI+7)   /* font of title text           */
  1180. #define EI_US_FHEIGHT      (IG_GETFI+6)   /* fontheight                   */
  1181. #define EI_US_NAME         (IG_GETFI+5)   /* title, use IG_Write          */
  1182. #define EI_US_MIDDLE       (IG_GETFI+4)   /* main border pen              */
  1183. #define EI_US_DARK         (IG_GETFI+3)   /* dark border pen              */
  1184. #define EI_US_LIGHT        (IG_GETFI+2)   /* light border pen             */
  1185. #define EI_US_WIDTH        (IG_GETFI+1)   /* full window width and height */
  1186. #define EI_US_HEIGHT       (IG_GETFI+0)   /* including the border         */
  1187.  
  1188. struct EI_UserStyle {
  1189.         WORD          BorderLeft, BorderTop,
  1190.                   BorderRight, BorderBottom;
  1191.            IG_IntuiGfxPtr DrawBorder;
  1192. };
  1193.  
  1194.  
  1195. struct EI_NewWindow {
  1196.          WORD             LeftEdge, TopEdge,
  1197.                   Width, Height;
  1198.          WORD             MinWidth, MinHeight,
  1199.                   MaxWidth, MaxHeight;
  1200.          EI_ScreenPtr     Screen;
  1201.  
  1202.  /* Tag for this union is hidden by WindowUserStyle flag in "flags" field */
  1203.  
  1204.          union {
  1205.         ULONG             SysGadgets;
  1206.         EI_UserStylePtr   UserStyle;
  1207.  
  1208.          } Bordef;
  1209.  
  1210.         EI_GadgetPtr        FirstGadgets;
  1211.         char               *Title;
  1212.         ULONG               Flags;
  1213.         ULONG               IDCMPFlags;
  1214.         struct MsgPort     *Port;
  1215.         struct IG_WinColors Colors;
  1216.         EI_MenuPtr          Menu;
  1217.         IG_IntuiGfxPtr      Render;
  1218. };
  1219.  
  1220. #endif /* EGS_EGSINTUI_H */
  1221.  
  1222.  
  1223.